package com.hjq.mallseckill;

import org.springframework.amqp.rabbit.annotation.EnableRabbit;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession;

/**
 * 整合sentinel
 * 1.导入依赖
 * 2.下载控制台
 * 3.配置
 * spring.cloud.sentinel.transport.dashboard：和控制台交互的端口
 * spring.cloud.sentinel.transport.dashboard:控制台端口
 *
 * 流量图表
 * 1.引入actuator
 * 2.配置：management:
 *   endpoints:
 *     web:
 *       exposure:
 *         include: *
 * feign接口的降级
 * 1.配置
 * feign.entinel.enabled=ture
 * 2.编写实现方法，在@feignClients增加fallBack属性
 *
 *自定义方法
 * 1.try(Entry entry= SphU.entry("getCurrentSecSkus"){} catch(BlockExeption e)
 * 2所在方法加上 @SentinelResource(value = "getCurrentSecSku",blockHandler = "getCurrentSecSkusHandler")
 * BlockHandler在所在类内
 */
@SpringBootApplication(exclude = DataSourceAutoConfiguration.class)
@EnableRedisHttpSession
@EnableFeignClients
@EnableDiscoveryClient
@EnableRabbit
public class MallSeckillApplication {

    public static void main(String[] args) {
        SpringApplication.run(MallSeckillApplication.class, args);
    }

}
